package com.lm.stream.service.impl;

import com.lm.stream.service.MessageChannels;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;

@Service
public class MessageProducer {

    private final MessageChannels channels;

    public MessageProducer(MessageChannels channels) {
        this.channels = channels;
    }

    public void send(String message) {
        channels.output().send(
                MessageBuilder.withPayload(message).build()
        );
        System.out.println("✅ 发送消息成功: " + message);
    }
}
